/* 
 * File:   quicksort.h
 * Author: gustavo
 *
 * Created on August 7, 2011, 2:38 AM
 */

#ifndef GQSORT_H
#define	GQSORT_H

#ifdef	__cplusplus
extern "C" {
#endif

	/**
	 * Quick Sort Algorithm for vectors of type char, int, float and real.
	 * 
	 * These functions support arrays of char, int, float or real.
	 * 
     * @param base: The array.
     * @param total_elements: Number of elements of the array.
     */
	void qsort_char(char * base, int total_elements);
	void qsort_int(int * base, int total_elements);
	void qsort_float(float * base, int total_elements);
	void qsort_double(int * base, int total_elements);
	/**
	 * Generic Quick Sort algorithm.
	 * 
	 * This function supports any data structure array
	 * with a defined compare method.
	 * 
	 * @param base: a pointer to the first element of the array.
	 * @param total_elements: number of elements in the array.
	 * @param unit_size: size of data structure (bytes)
	 * @param compare: a function that compare the elements e1 and e2.
	 * The parameters e1 and e2 must be a pointer to the structure stored
	 * in base vector.
	 * if( e1 < e2 ) then returns a negative value.
	 * if( e1 > e2 ) then returns a positive value.
	 * if( e1 == e2 ) then returns 0.
	 */
	void gqsort(void * base, long int total_elements, long int unit_size, int (*compare)(void * e1, void * e2));




#ifdef	__cplusplus
}
#endif

#endif	/* QUICKSORT_H */

